<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="Comment.CommentDeal"%>
<%@page import="java.util.*" %>
<%

//需要先实例化对象
CommentDeal Comment=new CommentDeal();

Comment.setBuyerID((String)session.getAttribute("user"));
//Comment.setComID(Integer.parseInt(request.getParameter("r")));
int k=0;
try{
	k=Integer.parseInt(request.getParameter("r"));
}catch(Exception e)
{
	e.printStackTrace();
}
Comment.setComID(k);
String SellerID=request.getParameter("SellerID");
Comment.setSellerID(SellerID);
Comment.setCommentID(Comment.CalCommentID());
Comment.setCommentTime(Comment.CoTime);
%>

<html>
  <head>
    <title>上传评价信息</title>
  </head>
  <body>
  <%
    if(Comment.AddComment(Comment.getCommentID(),Comment.getSellerID(),Comment.getBuyerID(),Comment.getCommentTime(),Comment.getComID())==0)
	{
       
	   out.print("<script>alert('评价失败，请重新尝试  ')</script>");
    }
    else
    {
       Comment.UpdateScore(Comment.getSellerID());
	   out.print("<script>alert('评价成功')</script>");
	   
    }
    %>
  	 <script type="text/javascript">

        window.location.href="../GridCommodity/GridCommodity.jsp";    

   </script>
  </body>
</html>
